<?php
	$lop = new lopbs();
	if(isset($_GET['khoi']))
		$lop->MaKhoi = $_GET['khoi'];
	$danhsach = $lop->GetList();
	
	$phanlop = new phanlopbs();
		
?>
<h3>Danh mục lớp</h3>
<table class="List">
	<tr>
		<th>SST</th>
		<th>Tên lớp</th>
        <th>Phân lớp</th>
		<th>Sửa</th>
		<th>Xóa</th>
	</tr>
	<?php
				for($i = 0; $i < count($danhsach); $i++)
				{
					$phanlop->MaLop =$danhsach[$i]['MaLop'];
					$ds = $phanlop->GetList();
					$stt=$i+1;
					echo "<tr>";
						echo "<td>$stt</td>";
						echo "<td>{$danhsach[$i]['TenLop']}</td>";
						if($ds)
						echo "<td  align='center'><a href= 'lop-phanlop-".$danhsach[$i]['MaLop']."'><img src='images/active.png' title = 'Phân lớp'/></a></td>";
						else
						echo "<td  align='center'><a href= 'lop-phanlop-".$danhsach[$i]['MaLop']."'><img src='images/ban.png' title = 'Chưa phân lớp'/></a></td>";
						echo "<td align='center'><a href='lop-sua-" . $danhsach[$i]['MaLop'] . "'><img src='images/edit.png' title = 'Sửa'/></a></td>";
						echo "<td align='center'><a href='lop-xoa-" . $danhsach[$i]['MaLop'] . "' onclick='return confirm(\"Bạn có muốn xóa " . $danhsach[$i]['MaLop'] . " không?\")'><img src='images/delete.png' title = 'Xóa'/></a></td>";
					echo "</tr>";
				}
			?>
</table>
<?php
	if(isset($_SESSION['MaNguoiDung'])&& $_SESSION['QuyenHan'] == 1)
	echo '<a href="lop-them">Thêm lớp</a> | <a href="lop-timkiem">Tìm kiếm</a>';

?>
